"""异常类型配置

包含 Python 标准异常类型到 C++ 异常类型的映射配置
"""

# 异常类型配置
CONFIG = {
    # 通用异常基类
    "Exception": {
        "cpp_type": "mc::exception",
        "includes": ["<mc/exception.h>"],
        "is_type": True,
        "module": "builtins",
        "pass_by": "const_ref",
        "description": "所有异常的基类",
        "methods": {
            "__str__": {
                "signatures": ["__str__(self: Exception) -> str"],
                "templates": ["{self}.what()"],
                "description": "获取异常消息",
                "priority": 1,
            },
        },
    },
    # 具体异常类型继承自 Exception
    "ValueError": {
        "cpp_type": "mcpy::value_error",
        "includes": ["<mcpy/exception.h>"],
        "is_type": True,
        "module": "builtins",
        "pass_by": "const_ref",
        "description": "值错误异常",
        "inherit_from": "Exception",
    },
    "TypeError": {
        "cpp_type": "mcpy::type_error",
        "includes": ["<mcpy/exception.h>"],
        "is_type": True,
        "module": "builtins",
        "pass_by": "const_ref",
        "description": "类型错误异常",
        "inherit_from": "Exception",
    },
    "IndexError": {
        "cpp_type": "mcpy::index_error",
        "includes": ["<mcpy/exception.h>"],
        "is_type": True,
        "module": "builtins",
        "pass_by": "const_ref",
        "description": "索引错误异常",
        "inherit_from": "Exception",
    },
    "KeyError": {
        "cpp_type": "mcpy::key_error",
        "includes": ["<mcpy/exception.h>"],
        "is_type": True,
        "module": "builtins",
        "pass_by": "const_ref",
        "description": "键错误异常",
        "inherit_from": "Exception",
    },
    "AttributeError": {
        "cpp_type": "mcpy::attribute_error",
        "includes": ["<mcpy/exception.h>"],
        "is_type": True,
        "module": "builtins",
        "pass_by": "const_ref",
        "description": "属性错误异常",
        "inherit_from": "Exception",
    },
    "NameError": {
        "cpp_type": "mcpy::name_error",
        "includes": ["<mcpy/exception.h>"],
        "is_type": True,
        "module": "builtins",
        "pass_by": "const_ref",
        "description": "名称错误异常",
        "inherit_from": "Exception",
    },
    "ZeroDivisionError": {
        "cpp_type": "mcpy::zero_division_error",
        "includes": ["<mcpy/exception.h>"],
        "is_type": True,
        "module": "builtins",
        "pass_by": "const_ref",
        "description": "除零错误异常",
        "inherit_from": "Exception",
    },
    "OverflowError": {
        "cpp_type": "mcpy::overflow_error",
        "includes": ["<mcpy/exception.h>"],
        "is_type": True,
        "module": "builtins",
        "pass_by": "const_ref",
        "description": "溢出错误异常",
        "inherit_from": "Exception",
    },
    "RuntimeError": {
        "cpp_type": "mcpy::runtime_error",
        "includes": ["<mcpy/exception.h>"],
        "is_type": True,
        "module": "builtins",
        "pass_by": "const_ref",
        "description": "运行时错误异常",
        "inherit_from": "Exception",
    },
    "NotImplementedError": {
        "cpp_type": "mcpy::not_implemented_error",
        "includes": ["<mcpy/exception.h>"],
        "is_type": True,
        "module": "builtins",
        "pass_by": "const_ref",
        "description": "未实现错误异常",
        "inherit_from": "Exception",
    },
    "StopIteration": {
        "cpp_type": "mcpy::stop_iteration",
        "includes": ["<mcpy/exception.h>"],
        "is_type": True,
        "module": "builtins",
        "pass_by": "const_ref",
        "description": "停止迭代异常",
        "inherit_from": "Exception",
    },
}
